<div class="main-container">
    <div class="search-wrap">
        <form nz-form [nzLayout]="'inline'" [formGroup]="searchForm">
            <nz-form-item>
                <nz-form-label>演练类型</nz-form-label>
                <nz-form-control>
                    <nz-select formControlName="drillType" nzAllowClear nzPlaceHolder="演练类型">
                        <nz-option nzLabel="抢险演练" nzValue="1"></nz-option>
                        <nz-option nzLabel="应急演练" nzValue="2"></nz-option>
                        <nz-option nzLabel="防汛演练" nzValue="3"></nz-option>
                    </nz-select>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>演练地点</nz-form-label>
                <nz-form-control>
                    <input formControlName="drillLocaltion" nz-input placeholder="演练地点" />
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>时间范围</nz-form-label>
                <nz-form-control>
                    <nz-range-picker formControlName="rangePickerTime" nzShowTime [nzPlaceHolder]="['起始日期', '截止日期']">
                    </nz-range-picker>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button nzType="primary" (click)="queryInfo(true)"><i nz-icon nzType="search"></i>查询
                    </button>
                </nz-form-control>
            </nz-form-item>
        </form>
        <button nz-button nzType="danger" class="add-btn" (click)="openEditModal()">
            <i nz-icon nzType="plus" nzTheme="outline"></i>新增
        </button>
    </div>

    <div class="main-wrap">
        <nz-table #dataTable class="main-table" [nzData]="tableData" [nzTotal]="total" [nzFrontPagination]="false"
            [(nzPageIndex)]="pageNum" [(nzPageSize)]="pageSize" [nzLoading]="loading" (nzPageIndexChange)="queryInfo()"
            nzBordered nzSize="middle">
            <thead>
                <tr>
                    <th>编号</th>
                    <th>演练名称</th>
                    <th>演练类型</th>

                    <th>演练地点</th>
                    <th>演练描述</th>
                    <th>责任人</th>
                    <th>演练时间</th>
                    <th>参与单位</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let data of dataTable.data">
                    <td>{{data.drillCode}}</td>
                    <td>{{data.drillName}}</td>
                    <td>
                        <div *ngIf="data.drillType===1">抢险演练</div>
                        <div *ngIf="data.drillType===2">应急演练</div>
                        <div *ngIf="data.drillType===3">防汛演练</div>

                    </td>

                    <td>{{data.drillLocaltion}}</td>
                    <td>{{data.drillInfo}}</td>
                    <td>{{data.manager}}</td>
                    <td>{{data.drillTime}}</td>
                    <td>{{data.participatingUnit}}</td>
                    <td>{{data.remarks}}</td>
                    <td>
                        <a (click)="openEditModal(false, data)">详情</a>
                        <nz-divider nzType="vertical"></nz-divider>
                        <a (click)="openEditModal(true, data)">编辑</a>
                        <nz-divider nzType="vertical"></nz-divider>
                        <a nz-popconfirm nzPopconfirmTitle="确认删除？" nzPopconfirmPlacement="left"
                            (nzOnConfirm)="onDelete(data.id)">
                            删除
                        </a>
                    </td>
                </tr>
            </tbody>
        </nz-table>
    </div>

    <nz-modal nzClassName="custom-modal pm-flood-modal" nzWidth="760" [(nzVisible)]="modalShow"  [nzFooter]="queryType" [nzTitle]="modalTitle"
        (nzOnCancel)="onCancel()" (nzOnOk)="onConfirm()">
        <form nz-form [formGroup]="form">
            <div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">编号</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="drillCode" placeholder="编号">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">演练名称</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="drillName" placeholder="演练名称">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">演练类型</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <nz-select formControlName="drillType" nzPlaceHolder="演练类型">
                                <nz-option nzLabel="抢险演练" nzValue="1"></nz-option>
                                <nz-option nzLabel="应急演练" nzValue="2"></nz-option>
                                <nz-option nzLabel="防汛演练" nzValue="3"></nz-option>

                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">演练地点</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="drillLocaltion" placeholder="演练地点">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">演练描述</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="drillInfo" placeholder="演练描述">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">演练时间</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <nz-date-picker formControlName="drillTime" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"
                                nzPlaceHolder="演练时间"></nz-date-picker>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">责任人</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="manager" placeholder="责任人">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">参与单位</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="participatingUnit" placeholder="参与单位">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="24">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="3">备注</nz-form-label>
                        <nz-form-control [nzSpan]="20">
                            <textarea formControlName="remarks" nz-input rows="2"></textarea>
                        </nz-form-control>
                    </nz-form-item>
                </div>
            </div>
        </form>
    </nz-modal>

</div>